package com.youlai.system.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.system.common.model.Option;
import com.youlai.system.model.entity.SysMold;
import com.youlai.system.model.form.MoldForm;
import com.youlai.system.model.vo.MoldPageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 故障类型对象转换器
 */
@Mapper(componentModel = "spring")
public interface MoldConverter {
    Page<MoldPageVO> entity2Page(Page<SysMold> page);

    SysMold form2Entity(MoldForm moldForm);

    MoldForm entity2Form(SysMold entity);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "name")
    })
    Option entity2Option(SysMold mold);


    List<Option> entities2Options(List<SysMold> molds);
}
